package com.abocode.aichat.server.context;

import com.abocode.aichat.server.context.channel.ProtocolChannelRegistry;
import com.abocode.aichat.server.context.delivery.inbound.InboundServerDeliver;
import com.abocode.aichat.server.context.delivery.outbound.OutboundServerDeliver;
import com.abocode.aichat.server.context.pipeline.MessagePipeline;
import com.abocode.aichat.server.context.worker.Worker;
import lombok.Getter;
import lombok.Setter;

/***
 *
 */
@Getter
@Setter

public class ServerRuntimeContext {

    private String domain;

    private String name;

    private ProtocolChannelRegistry protocolChannelRegistry;

    private MessagePipeline messagePipeline;

    private InboundServerDeliver inboundServerDeliver;

    private OutboundServerDeliver outboundServerDeliver;

    private Worker worker;


    public void setInboundServerDeliver(InboundServerDeliver inboundServerDeliver) {
        this.inboundServerDeliver = inboundServerDeliver;
        inboundServerDeliver.setServerRuntimeContext(this);
    }


    public void setOutboundServerDeliver(OutboundServerDeliver outboundServerDeliver) {
        this.outboundServerDeliver = outboundServerDeliver;
        outboundServerDeliver.setServerRuntimeContext(this);
    }


    public void setWorker(Worker worker) {
        this.worker = worker;
        worker.setServerRuntimeContext(this);
    }

    public boolean validateDomain(String domain) {
        return getDomain().equals(domain);
    }
}
